export const detailConfig = {
	inline: false,
	showBtn: true,
	labelPosition: 'top',
	labelWidth: '120px',
	column: [
		{
			type: 'DividerHtml',
			labelPosition: 'top',
			position: 'center',
			modelValue: '操作记录',
			span: 24,
		},
		{
			label: '工单编号',
			prop: 'orderNo',
			span: 8,
		},
		{
			label: '服务对象姓名',
			prop: 'elderlyName',
			span: 8,
		},
		{
			label: '服务对象身份证号',
			prop: 'elderlyIdCard',
			span: 8,
		},
		{
			label: '服务对象联系方式',
			prop: 'elderlyPhone',
			span: 8,
		},
		{
			label: '服务对象地址',
			prop: 'crAddress',
			span: 8,
		},
		{
			label: '服务员姓名',
			prop: 'staffName',
			span: 8,
		},
		{
			label: '服务员联系方式',
			prop: 'staffPhone',
			span: 8,
		},
		{
			label: '服务组织',
			prop: 'organizationName',
			span: 8,
		},
		{
			label: '服务项目',
			prop: 'subItemNames',
			span: 8,
		},
		{
			type: 'DividerHtml',
			labelPosition: 'top',
			position: 'center',
			modelValue: '回访详情',
			span: 24,
		},
		{
			label: '回访抽查记录结果',
			prop: 'visitResult',
			type: 'radio',
			code: 'OM_VISIT_RESULT',
			api: 'getDictItemList',
			span: 24,
		},
		{
			label: '是否老人本人',
			prop: 'selfElderlyFlag',
			code: 'COMMON_FLAG',
			span: 8,
		},
		{
			label: '与老人的关系',
			prop: 'relationShipLabel',
			span: 8,
		},
		{
			label: '是否享受服务',
			prop: 'enjoyServiceFlag',
			code: 'COMMON_FLAG',
			span: 8,
		},
		{
			label: '享受服务的内容',
			prop: 'enjoyServiceContent',
			span: 8,
		},
		{
			label: '是否还需要其他服务',
			prop: 'otherServiceFlag',
			code: 'COMMON_FLAG',
			span: 8,
		},
		{
			label: '需要其他服务的内容',
			prop: 'otherServiceContent',
			span: 8,
		},
		{
			label: '服务频次（次数）',
			prop: 'serviceFrequency',
			span: 8,
		},
		{
			label: '服务时长（分钟）',
			prop: 'serviceLength',
			span: 8,
		},
		{
			label: '服务人员是否留有联系方式',
			prop: 'leaveStaffPhoneFlag',
			code: 'COMMON_FLAG',
			span: 8,
		},
		{
			label: '服务人员是否固定',
			prop: 'staffFixedFlag',
			code: 'COMMON_FLAG',
			span: 8,
		},
		{
			label: '是否知晓服务组织名称',
			prop: 'knowOrgNameFlag',
			code: 'COMMON_FLAG',
			span: 8,
		},
		{
			label: '是否知晓政策',
			prop: 'knowPolicyFlag',
			code: 'COMMON_FLAG',
			span: 8,
		},
		{
			label: '服务员是否穿着工作服、佩戴工牌',
			prop: 'staffNeatlyFlag',
			code: 'COMMON_FLAG',
			span: 8,
		},
		{
			label: '服务组织是否提供服务清单',
			prop: 'serviceListFlag',
			code: 'COMMON_FLAG',
			span: 8,
		},
		{
			label: '是否签订服务协议',
			prop: 'agreementFlag',
			code: 'COMMON_FLAG',
			span: 8,
		},
		{
			label: '是否异常',
			prop: 'exceptionFlag',
			code: 'COMMON_FLAG',
			span: 8,
		},
		{
			label: '对服务人员的整体评价',
			prop: 'wholeEvaluate',
			span: 24,
		},
		{
			label: '服务意见和建议',
			prop: 'serviceAdvice',
			span: 24,
		},
		{
			label: '备注',
			prop: 'visitNote',
			span: 24,
		},
		{
			type: 'DividerHtml',
			labelPosition: 'top',
			position: 'center',
			modelValue: '回访信息',
			span: 24,
		},
		{
			label: '回访录音',
			prop: 'visitAudio',
			span: 24,
		},
		{
			label: '回访人',
			prop: 'createUserName',
			span: 24,
		},
		{
			label: '（自动）客服回访时间',
			prop: '',
			span: 24,
		},
	],
}

export const formConfig = {
	inline: false,
	showBtn: true,
	labelPosition: 'top',
	labelWidth: '120px',
	column: [
		{
			label: '回访抽查记录结果',
			prop: 'visitResult',
			propName: 'visitResultLabel',
			type: 'radio',
			dicData: [
				{ label: '满意', value: '1' },
				{ label: '基本满意', value: '2' },
				{ label: '不满意', value: '3' },
				{ label: '未进行服务', value: '4' },
				{ label: '基本信息错误', value: '5' },
				{ label: '无法接听', value: '6' },
				{ label: '不清楚', value: '7' },
			],
			rules: [{ required: true, message: '请选择回访抽查记录结果' }],
			span: 24,
		},
		{
			label: '是否老人本人',
			prop: 'selfElderlyFlag',
			type: 'remoteSelect',
			api: 'getDictItemList',
			code: 'COMMON_FLAG',
			filterKey: 'value',
			multiple: false,
			span: 12,
			rules: [{ required: true, message: '请选择是否老人本人' }],
		},
		{
			label: '和老人关系',
			prop: 'relationShip',
			propName: 'relationShipLabel',
			type: 'remoteSelect',
			code: 'ELDERLY_RELATIONSHIP',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
			span: 12,
			rules: [{ required: true, message: '请选择和老人关系' }],
		},
		{
			label: '是否享受服务',
			prop: 'enjoyServiceFlag',
			type: 'remoteSelect',
			api: 'getDictItemList',
			code: 'COMMON_FLAG',
			filterKey: 'value',
			multiple: false,
			span: 12,
			rules: [{ required: true, message: '请选择是否享受服务' }],
			// control: (e, model) => {
			// 	return {
			// 		enjoyServiceContent: {
			// 			display: e != 1,
			// 		},
			// 	}
			// },
		},
		{
			label: '享受服务的内容',
			prop: 'enjoyServiceContent',
			type: 'text',
			span: 12,
			rules: [{ required: true, message: '请输入享受服务的内容' }],
		},
		{
			label: '是否还需要其他服务',
			prop: 'otherServiceFlag',
			type: 'remoteSelect',
			api: 'getDictItemList',
			code: 'COMMON_FLAG',
			filterKey: 'value',
			multiple: false,
			span: 12,
			rules: [{ required: true, message: '请选择是否还需要其他服务' }],
		},
		{
			label: '需要其他服务的内容',
			prop: 'otherServiceContent',
			span: 12,
			type: 'text',
			rules: [{ required: true, message: '需要其他服务的内容' }],
		},
		{
			label: '服务频次（次数）',
			prop: 'serviceFrequency',
			type: 'text',
			span: 8,
			rules: [{ required: true, message: '服务频次（次数）' }],
		},
		{
			label: '服务时长（分钟）',
			prop: 'serviceLength',
			type: 'text',
			span: 8,
			rules: [{ required: true, message: '服务时长（分钟）' }],
		},
		{
			label: '服务人员是否留有联系方式',
			prop: 'leaveStaffPhoneFlag',
			type: 'remoteSelect',
			api: 'getDictItemList',
			code: 'COMMON_FLAG',
			filterKey: 'value',
			multiple: false,
			span: 8,
			rules: [{ required: true, message: '服务人员是否留有联系方式' }],
		},
		{
			label: '服务人员是否固定',
			prop: 'staffFixedFlag',
			type: 'remoteSelect',
			api: 'getDictItemList',
			code: 'COMMON_FLAG',
			filterKey: 'value',
			multiple: false,
			rules: [{ required: true, message: '服务人员是否固定' }],
			span: 8,
		},
		{
			label: '是否知晓服务组织名称',
			prop: 'knowOrgNameFlag',
			type: 'remoteSelect',
			api: 'getDictItemList',
			code: 'COMMON_FLAG',
			filterKey: 'value',
			multiple: false,
			span: 8,
			rules: [{ required: true, message: '是否知晓服务组织名称' }],
		},
		{
			label: '是否知晓政策',
			prop: 'knowPolicyFlag',
			type: 'remoteSelect',
			api: 'getDictItemList',
			code: 'COMMON_FLAG',
			filterKey: 'value',
			multiple: false,
			span: 8,
			rules: [{ required: true, message: '是否知晓政策' }],
		},
		{
			label: '服务员是否穿着工作服、佩戴工牌',
			prop: 'staffNeatlyFlag',
			type: 'remoteSelect',
			api: 'getDictItemList',
			code: 'COMMON_FLAG',
			filterKey: 'value',
			multiple: false,
			span: 8,
			rules: [{ required: true, message: '服务员是否穿着工作服、佩戴工牌' }],
		},
		{
			label: '服务组织是否提供服务清单',
			prop: 'serviceListFlag',
			type: 'remoteSelect',
			api: 'getDictItemList',
			code: 'COMMON_FLAG',
			filterKey: 'value',
			multiple: false,
			span: 8,
			rules: [{ required: true, message: '服务组织是否提供服务清单' }],
		},
		{
			label: '是否签订服务协议',
			prop: 'agreementFlag',
			type: 'remoteSelect',
			api: 'getDictItemList',
			code: 'COMMON_FLAG',
			filterKey: 'value',
			multiple: false,
			rules: [{ required: true, message: '是否签订服务协议' }],
			span: 8,
		},
		{
			label: '是否异常',
			prop: 'exceptionFlag',
			type: 'remoteSelect',
			api: 'getDictItemList',
			code: 'COMMON_FLAG',
			filterKey: 'value',
			multiple: false,
			span: 8,
			rules: [{ required: true, message: '请选择是否异常' }],
		},
		{
			label: '对服务人员的整体评价',
			prop: 'wholeEvaluate',
			maxlength: '140',
			showWordLimit: true,
			autosize: {
				minRows: 1,
			},
			type: 'textarea',
			span: 24,
		},
		{
			label: '服务意见和建议',
			prop: 'serviceAdvice',
			code: 'COMMON_FLAG',
			maxlength: '140',
			showWordLimit: true,
			autosize: {
				minRows: 1,
			},
			type: 'textarea',
			span: 24,
		},
		{
			label: '备注',
			prop: 'visitNote',
			span: 24,
			maxlength: '140',
			showWordLimit: true,
			autosize: {
				minRows: 1,
			},
			type: 'textarea',
		},
	],
}

export const searchConfig = {
	inline: true,
	showBtn: true,
	labelPosition: 'left',
	column: [
		{
			label: '批次名称',
			prop: 'spotBatchName',
			type: 'input',
			span: 8,
		},
		{
			label: '工单编号',
			prop: 'orderNo',
			type: 'input',
			span: 8,
		},
		{
			label: '服务组织机构',
			prop: 'organizationName',
			type: 'input',
			span: 8,
		},
		{
			label: '服务对象',
			prop: 'elderlyName',
			type: 'input',
			span: 8,
		},
		{
			label: '身份证号',
			prop: 'elderlyIdCard',
			type: 'input',
			span: 8,
		},
		{
			label: '服务员',
			prop: 'staffName',
			type: 'input',
			span: 8,
		},
		{
			label: '回访状态',
			prop: 'visitStatus',
			type: 'select',
			dicData: [
				{
					label: '未回访',
					value: 0,
				},
				{
					label: '已回访',
					value: 1,
				},
			],
			span: 8,
		},
		{
			label: '回访结果',
			prop: 'visitResult',
			type: 'remoteSelect',
			code: 'OM_VISIT_RESULT',
			api: 'getDictItemList',
			dataType: 'number',
			filterKey: 'value',
			multiple: false,
			span: 8,
		},
		{
			label: '异常状态',
			prop: 'exceptionFlag',
			type: 'select',
			dicData: [
				{
					label: '否',
					value: 0,
				},
				{
					label: '是',
					value: 1,
				},
			],
			span: 8,
		},
		{
			label: '回访时间',
			prop: 'visitTimeBetween',
			type: 'dateBetween',
			valueFormat: 'YYYY-MM-DD HH:mm:ss',
			span: 8,
		},
	],
}

export const tableConfig = {
	stripe: true,
	border: true,
	showOverflowTooltip: false,
  colMinWidth:'128',
	columns: [
		{ label: '批次名称', prop: 'spotBatchName' },
		{ label: '工单编号', prop: 'orderNo' },
		{ label: '所属区', prop: 'orgAreaName' },
		{ label: '所属街道', prop: 'orgStreetName' },
		{ label: '所属社区', prop: 'orgCommunityName' },
		{ label: '所属组织机构', prop: 'organizationName' },
		{ label: '服务对象姓名', prop: 'elderlyName' },
		{ label: '身份证号', prop: 'elderlyIdCard' },
		{ label: '服务员', prop: 'staffName' },
		{ label: '工单时间', prop: 'startTime' },
		{
			label: '回访状态',
			prop: 'visitStatus',
			custome: 'PointStatus',
			dicData: [
				{
					label: '未回访',
					value: 0,
					color: '#E80000',
				},
				{
					label: '已回访',
					value: 1,
					color: '#00C92F',
				},
			],
		},
		// { label: '抽查记录', prop: 'batchName' },
		{ label: '回访结果', prop: 'visitResultLabel' },
		{
			label: '是否异常',
			prop: 'exceptionFlag',
			custome: 'PointStatus',
			dicData: [
				{
					label: '否',
					value: 0,
					color: '#00C92F',
				},
				{
					label: '是',
					value: 1,
					color: '#E80000',
				},
			],
		},
		{ label: '回访时间', prop: 'visitTime' },
		{ label: '抽查人', prop: 'createUserName' },
		{
			label: '操作',
			prop: 'menu',
			width: 140,
			fixed: 'right',
		},
	],
}

export const api = {
	index: 'view_omSpotOrder_page',
	edit: 'view_omSpotOrder_visitBack',
	detail: 'view_omSpotOrder_view',
}
export const auth = {
	...api,
}
export const baseConfig = {
	pageName: '回访工单',
	dictcodes: ['ELDERLY_RELATIONSHIP', 'OM_VISIT_RESULT', 'COMMON_FLAG'],
	rowKey: 'id',
	addLabel: '新增',
	tipLabel: 'batchName',
	exportMqTopic: '/ning/export/',
	api,
	auth,
	menuBtn: [
		{
			icon: 'detail',
			label: '回访详情',
			type: 'primary',
			operate: 'detail',
			auth: auth.index,
			text: true,
			show: true,
		},
	],

	saveFormate: async (form) => {
		return new Promise((resolve, reject) => {
			if (form.repeatSpotBetween) {
				form.repeatSpotStartTime = form.repeatSpotBetween[0]
				form.repeatSpotEndTime = form.repeatSpotBetween[1]
			}
			if (form.spotTimeBetween) {
				form.spotStartTime = form.spotTimeBetween[0]
				form.spotEndTime = form.spotTimeBetween[1]
			}
			resolve({
				...form,
				repeatSpotBetween: undefined,
				spotTimeBetween: undefined,
			})
		})
	},
	beforeOnLoadFormate: async (query) => {
		return new Promise((resolve, reject) => {
			resolve(query)
		})
	},
	onLoadFormate: async (arr) => {
		return new Promise((resolve, reject) => {
			resolve(
				arr.map((item) => {
					item.repeatSpotBetween = [item.repeatSpotStartTime, item.repeatSpotEndTime]
					item.spotTimeBetween = [item.spotStartTime, item.spotEndTime]
					item.spotTimeBetweenLabel = item.spotTimeBetween.toString()
					return {
						...item,
					}
				})
			)
		})
	},
	dialogConfig: {
		width: '75%',
	},
	searchConfig,
	tableConfig,
	detailConfig,
	formConfig,
}
